<template>
  <div id="app">
    <a @click="current='L'">列表</a>
    <a @click="current='M'">电影</a>
    <keep-alive>
      <component :is="current"></component>
    </keep-alive>
    <!-- <button class="btn btn-danger">按钮</button> -->
    <!-- <img alt="Vue logo" src="./assets/logo.png"> -->
  </div>
</template>

<script>
import L from "./components/List";
import M from "./components/Movies";
export default {
  name: "App",
  components: {
    // 当属性和属性值相同时可只写一个
    L,
    M
  },
  data() {
    return {
      // 表示第一次显示的是L这个组件
      current: L
    };
  }
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  /* margin-top: 60px; */
}
a {
  cursor: pointer;
}
</style>
